package com.xiemingtian.navdemo.code


import android.os.Bundle
import android.support.v4.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.xiemingtian.navdemo.Nav

import com.xiemingtian.navdemo.R
import kotlinx.android.synthetic.main.fragment_code_fragment1.*

@Nav(id = Id.f1,actions = [Id.a1],isStart = true, dest = [Id.f2])
class CodeFragment1 : Fragment() {

    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
                              savedInstanceState: Bundle?): View? {
        return inflater.inflate(R.layout.fragment_code_fragment1, container, false)
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        buttonJump.setOnClickListener {
            val activity = activity as CodeNavActivity
            activity.getNavController().navigate(Id.a1)
        }
    }
}
